<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>123</div>
    <p>
        我是文字
        <span>123</span>
    </p>
    <script>
        var div = document.querySelector('div');
        // div.innerText = ' <strong>今天是</strong>2021年';
        div.innerHTML = ' <strong>今天是</strong>2021年';
        var p = document.querySelector('p');
        console.log(p.innerText);
    </script>
</body>

</html>